/*
 * Copyright (C) 2022 KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <https://www.gnu.org/licenses/>.
 */

pragma Singleton
import QtQuick 2.12
import QtQml 2.12
import QtQuick.Window 2.12

QtObject {
    //edu-screen
    property real widthScaleFactor :  Screen.width / 1920 //1
    property real heightScaleFactor :  Screen.height / 1080//1

//    property real tabletWidthScaleFactor : (Screen.width /  (Screen.width > Screen.height ? 1620 : 1080))// 1.3333
//    property real tabletHeightScaleFactor : (Screen.height / (Screen.width > Screen.height ? 1080 : 1620))


    property real tabletScaleFactor: (Screen.width >= Screen.height ? Screen.height / 1080 : Screen.width / 1080)

    property real appIconGridWidth: 240 * tabletScaleFactor
    property real appIconGridHeight: 194 * tabletScaleFactor

    // 长按进入编辑状态的时间
    property int pressIntervalToEditable: 300

    // 分组名称最大的长度
    property int maxTitleLength: 32

    property real dpScale:  1.5
    readonly property real dp: Math.max(Screen.pixelDensity * 25.4 / 160 * dpScale, 1)

    property real defaultPixDensity: 3.611320754716981  //pixel density of my current screen
    property real scaleFactor: dp//Screen.pixelDensity / defaultPixDensity

    function dp(val) {
        return Math.round(val * (Screen.pixelDensity * 25.4 * Screen.devicePixelRatio / 160))
    }
    onTabletScaleFactorChanged: {
        console.log("onTabletScaleFactorChanged", tabletScaleFactor)
    }
}
